﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core.Enums;

namespace Core.Entities
{
    public delegate bool AsGetValueDelegate(ref object Value, string Name, int Index);

    public class DelegateReaderGetter : IReaderGetter
    {

        private readonly AsGetValueDelegate AsGetValueMethod;

        public DelegateReaderGetter(AsGetValueDelegate AsGetValueMethod)
        {
            if (AsGetValueMethod == null)
            {
                throw new NullReferenceException("AsGetValueMethod");
            }

            this.AsGetValueMethod = AsGetValueMethod;
        }

        public bool AsGetValue(ref object Value, string Name, int Index)
        {
            return AsGetValueMethod(ref Value, Name, Index);
        }
    }
}